//package com.cloud.pikachu.generator.controller;
//
//import com.cloud.pikachu.generator.service.IGenService;
//import com.cloud.pikachu.generator.util.Convert;
//import org.apache.commons.io.IOUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.*;
//
//import java.io.IOException;
//
///**
// * 代码生成 操作处理
// *
// * @author ruoyi
// */
//@Controller
//@RequestMapping("/tool/gen")
//public class GeneratorController{
//
//    @Autowired
//    private IGenService genService;
//
//    /**
//     * 生成代码
//     */
//    @GetMapping("/genCode/{tableName}")
//    public void genCode(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
//    {
//        byte[] data = genService.generatorCode(tableName);
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
//        response.addHeader("Content-Length", "" + data.length);
//        response.setContentType("application/octet-stream; charset=UTF-8");
//
//        IOUtils.write(data, response.getOutputStream());
//    }
//
//    /**
//     * 批量生成代码
//     */
//    @GetMapping("/batchGenCode")
//    @ResponseBody
//    public void batchGenCode(HttpServletResponse response, String tables) throws IOException
//    {
//        String[] tableNames = Convert.toStrArray(tables);
//        byte[] data = genService.generatorCode(tableNames);
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
//        response.addHeader("Content-Length", "" + data.length);
//        response.setContentType("application/octet-stream; charset=UTF-8");
//
//        IOUtils.write(data, response.getOutputStream());
//    }
//}
